<script type="text/javascript">
$(function () {
	$("a.link_contact").fancybox();
});
</script>
<div class="content">
	<h2>
		Hỏi đáp - Liên hệ <?php if(isset($user['id'])) : ?><a class="link_contact fr" href="#contact"><img src="<?php echo Yii::app()->theme->baseUrl;?>/front/images/button_contact.png"/>Đăng câu hỏi</a><?php endif;?>
	</h2>

	<div class="content_text">
		<?php if(isset($ticket_content)) : ?>
			<?php foreach($ticket_content as $value) : ?>
				<div class="comment">
					<div class="avatar">
						<a href="#"><img style="width: 50px;" src="<?php echo Yii::app()->baseUrl.'/images/avatar/'.$value['user']['avatar_url']?>" /></a>
					</div>
					<div class="cmt_content">
						<h3 class="fl"><?php echo $value['user']['name'] ?></h3>
						<span class="fr">
							<i>
								<?php 
									echo date("d-m-Y h:i",strtotime($value['supportTicket']['created_date'])); 
									// $date = new DateTime($value['supportTicket']['created_date']);
									// echo $date->format('d-m-Y H:i');
								?>
							</i>
						</span>
						<div class="clear"></div>
						<p><?php echo $value['supportTicket']['content'] ;?></p>
							<?php foreach($ticket_comment as $val) : ?>							
								<?php if($val['support_ticket_id'] == $value['supportTicket']['id']): ?>
									<ul class="comment_group">
										<li class="comment">
											<div class="avatar"><a href="#"><img style="width: 50px;" src="<?php echo Yii::app()->baseUrl.'/images/avatar/'.$val['user']['avatar_url']?>" /></a></div>
											<div class="cmt_content">
												<h3 class="fl"><?php echo $val['user']['name']; ?></h3>
												<span class="fr"><i><?php echo date("d-m-Y h:i",strtotime($val['created_date'])); ?></i></span>
												<div class="clear"></div>
												<p><?php echo $val['content']; ?></p>
											</div>
											<div class="clear"></div>
										</li>
									</ul>
								<?php endif; ?>
							<?php endforeach; ?>
						<ul class="comment_group">
							<?php if(isset($user['id'])) : ?>
							<li class="comment">
								<div class="avatar"><a href="#"><img style="width: 50px;" src="<?php echo Yii::app()->baseUrl.'/images/avatar/'.$user['avatar_url']?>" /></a></a></div>
								<div class="cmt_content">
									<h3 class="fl"><?php echo $user['name']; ?></h3>
									<!-- <span class="fr"><i><?php echo date('d-m-Y h:i'); ?></i></span> -->
									<div class="clear"></div>
									<form class="content_form" action="<?php echo Yii::app()->createUrl('supportticket/comment'); ?>" method="post">
										<textarea class='ans' name="Message[content]" placeholder="Nhập câu trả lời của bạn vào đây..."></textarea>
										<input type="hidden" value="<?php echo $value['supportTicket']['id']; ?>" name="Message[support_ticket_id]" />
										<input class="fr" type="submit" />
									</form>
								</div>
								<div class="clear"></div>
							</li>
							<?php endif; ?>
						</ul>
						</div>
					<div class="clear"></div>
				</div>
			<?php endforeach;?>
		<?php endif; ?>
	</div>
</div>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/front/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/front/js/validation.js"></script>